<template>
<span class="op_dir_Export-wrapper">
  <button v-if="btns.toSort" title="排序"
          class="ui circular icon primary button tiny"
          @click.stop.prevent="toSort()">
          <i class="icon icon-sort"></i>
        </button>
</span>
</template>
<script type="text/ecmascript-6">
    import tool from 'src/util/tool';
    import util from '_util/index';
    import logic from '_logic';
    import in_array from 'in_array';

    import btn_group from 'components/common/btn_group';


    export default {
        data() {
            return {}
        },
        components: {},
        methods: {
            toSort(){
                let filterData = util.store.get(this, `filterData.${this.ctl}`, 'list');
                let ctl_cat = filterData ? filterData.ctl_cat : null;

                if (ctl_cat)
                    this.$router.push('/page/sort?ctl=Export&ctl_cat=' + ctl_cat);
                else if (this.model_id)
                    this.$router.push('/page/sort?ctl=Export&model_id=' + this.model_id);
                else {
                    let option = {
                        bindModel: 4,
                        title: '请选择要排序的模型',
                        name: 'mid',
                        _id: 'op/Export'
                    };
                    util.showMybind(this, option, (fname, val, title) => {
                        let mid = val;
                        if (mid) {
                            this.$router.push('/page/sort?ctl=Export&model_id=' + mid);
                        }
                    });
                }


            },
        },
        computed: {
            model_id(){
                return this.$route.query.mid;
            },
            ctl(){
                return this.$route.query.ctl;
            },
            is_admin(){
                return util.is_admin(this);
            },
        },
        props: ['btns'],
        created() {
        },
    };
</script>
<style rel="stylesheet/less" lang="less">@dir: "header/";</style>
